﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _1_winform窗体
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            label1.Hide();
            this.BackColor = Color.Blue;
        }

        private void button1_Click(object sender, EventArgs e)
        {

            label1.Show();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //MessageBox.Show("Hello World");
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = MessageBox.Show("窗体即将关闭,确认要关闭吗?", "提示框", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result.ToString() == "Yes")
            {
                e.Cancel = false;
            }
            else { e.Cancel = true; }

        }
    }
}
